#pragma once 

#include "Core\NervusSharedHeader.h"
#include "Render\CRenderSystem.h"



namespace Nervus {
	namespace Render {




		class D3D9RenderSystem : public RenderSystem{
			friend class D3D9Mesh;
			friend class D3D9Sprite;

		private:
			LPDIRECT3D9 mMainDX;
			D3DPRESENT_PARAMETERS mDXParams;
			LPDIRECT3DDEVICE9 mVideoCard;

			u32 mFieldOfView;
			LPDIRECT3DTEXTURE9 mDefaultTexture;



			



			bool setDXSettings();
			void setRenderStates();
			void setProjectionMatrix();



		public:
			D3D9RenderSystem(Core::Window*);
			~D3D9RenderSystem();

			bool launchRenderSystem();
			bool toggleFullscreen();
			



			// Render funcs
			void beginRender(f32);
			void endRender();


			Mesh* createMesh(vector<MeshVertex>, DWORD*);
			Sprite* createSprite(D3DXVECTOR2, Texture*);

			void shaderOne();
			void shaderTwo();

			void enable3D();
			void enable2D();
		};
		
	}
}

